package com.leyou.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.leyou.order.dto.OrderDTO;
import com.leyou.order.entity.TbOrder;
import com.leyou.order.vo.OrderVo;
import com.leyou.seckill.dto.SecKillOrderDTO;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author HM
 * @since 2020-10-07
 */
public interface TbOrderService extends IService<TbOrder> {

    /**
     * 创建订单 并返回订单id
     * @param orderDTO
     * @return
     */
    Long createOrder(OrderDTO orderDTO);

    /**
     * 获取微信支付返回的codeurl
     * @param orderId
     * @return
     */
    String getCodeUrl(Long orderId);

    /**
     * 微信支付成功修改订单状态
     * @param reqData
     */
    void updateOrderStatus(Map<String, String> reqData);

    /**
     * 关闭过期未支付订单
     * @param overTime 过期时间点
     */
    @Transactional(rollbackFor = Exception.class)
    public void closeOverTimeOrder(String overTime);

    /**
     * 创建秒杀订单
     * @param secKillOrderDTO
     */
    void createSecKillOrder(SecKillOrderDTO secKillOrderDTO);

    /**
     * 根据id 查询订单信息
     * @param orderId
     * @return
     */
    OrderVo findOrderByOrderId(Long orderId);
}
